package com.wk.springboot.listener;

import org.springframework.batch.core.ChunkListener;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.stereotype.Component;

/**
 * @Classname MyChunkListener
 * @Description 自定义ChunkListener
 * 可以在chunk前后监听
 * @Date 2020/3/30 18:28
 * @Author by weikai
 */
@Component
public class MyChunkListener implements ChunkListener {

  @Override
  public void beforeChunk(ChunkContext context) {
    System.out.println("chunk开始时");
  }

  @Override
  public void afterChunk(ChunkContext context) {
    System.out.println("chunk结束时");
  }

  @Override
  public void afterChunkError(ChunkContext context) {
    System.out.println("chunk发生错误后");
  }
}
